//#define _CRT_SECURE_NO_WARNINGS 1
//#include<stdio.h>
//#include<stdlib.h>
//#include<stdbool.h>
//struct Node
//{
//	int iData;
//	struct Node* pNext;
//	struct Node* pPre;
//
//};
//struct Node* Stack();
//bool IsEmpty(struct Node* pStack);
//void Push(int data, struct Node* pStack);
//void FreeStack(struct Node** pStack);
//struct Node* Top(struct Node* pStack);
//void Pop(struct Node* pStack);
//int main(void)
//{
//	struct Node* pStack = Stack();
//	int arr[5] = { 1,2,3,4,5 };
//	Push(arr[0], pStack);
//	Push(arr[1], pStack);
//	Push(arr[2], pStack);
//	Push(arr[3], pStack);
//	Push(arr[4], pStack);
//	arr[0]=Top(pStack)->iData;
//	Pop(pStack);
//	arr[1] = Top(pStack)->iData;
//	Pop(pStack);
//	arr[2] = Top(pStack)->iData;
//	Pop(pStack);
//	arr[3] = Top(pStack)->iData;
//	Pop(pStack);
//	arr[4] = Top(pStack)->iData;
//	Pop(pStack);
//	for (int i = 0; i < 5; i++)
//	{
//		printf("%d ", arr[i]);
//	}
//	FreeStack(&pStack);
//	return 0;
//}
//void Pop(struct Node* pStack)
//{
//	if (pStack == NULL)
//		return;
//	if (IsEmpty(pStack))
//		return;
//	struct Node* ptemp = pStack->pPre;
//	pStack->pPre = pStack->pPre->pPre;
//	pStack->pPre->pNext = pStack;
//	free(ptemp);
//}
//struct Node* Top(struct Node* pStack)
//{
//	if (pStack == NULL)
//		return NULL;
//	if (IsEmpty(pStack))
//		return NULL;
//	return pStack->pPre;
//}
//void FreeStack(struct Node** pStack)
//{
//	if (pStack == NULL || *pStack == NULL)
//		return;
//	struct Node* ptemp = *pStack;
//	do
//	{
//		struct Node* pt = ptemp;
//		ptemp = ptemp->pNext;
//		free(pt);
//	} while (ptemp != *pStack);
//	*pStack = NULL;
//}
//void Push(int data, struct Node* pStack)
//{
//	if (pStack == NULL)
//		return;
//	struct Node* ptemp = (struct Node*)malloc(sizeof(struct Node));
//	if (NULL == ptemp)
//		return;
//	ptemp->iData = data;
//	ptemp->pNext = pStack;
//	ptemp->pPre = pStack->pPre;
//	pStack->pPre->pNext = ptemp;
//	pStack->pPre = ptemp;
//}
//bool IsEmpty(struct Node* pStack)
//{
//	if (NULL==pStack||pStack->pNext == pStack)
//		return true;
//	return false;
//}
//struct Node* Stack()
//{
//	struct Node* ptemp = (struct Node*)malloc(sizeof(struct Node));
//	if (ptemp == NULL)
//		return NULL;
//	ptemp->iData = -1;
//	ptemp->pNext = ptemp;
//	ptemp->pPre = ptemp;
//	return ptemp;
//}